package com.hdcircles.autoform.ui.label.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.PagerAdapter;
import android.view.ViewGroup;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by hdcircles on 2016/9/27.
 */

public class LabelMainAdapter extends FragmentPagerAdapter {

    private  List<Fragment> fragments;

    private  List<String> fragmentTitleList;

    public LabelMainAdapter(FragmentManager fm,List<Fragment> fragments,List<String> fragmentTitleList) {
        super(fm);
        this.fragmentTitleList=fragmentTitleList;
        this.fragments=fragments;
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }

    public int getItemPosition(Object object){
        return PagerAdapter.POSITION_NONE;
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
//        super.destroyItem(container, position, object);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return fragmentTitleList.get(position);
    }
}
